import json
import falcon
import uuid

def _generate_id():
    return str(uuid.uuid4())

class ImagesResource(object):

    # def __init__(self, storage_path):
    #     self.storage_path = storage_path

    def on_get(self, req, resp):

        resp.media = '哈哈哈'
        resp.status = falcon.HTTP_200
        return

        id = req.get_param('id')
        doc = {
            'images': [
                {
                    'href': '/images/1eaf6ef1-7f2d-4ecc-a8d5-6e8adba7cc0e.png'
                }
            ]
        }

        # Create a JSON representation of the resource
        resp.body = json.dumps(doc, ensure_ascii=False)

        # The following line can be omitted because 200 is the default
        # status returned by the framework, but it is included here to
        # illustrate how this may be overridden as needed.
        resp.status = falcon.HTTP_200


    def on_post(self, req, resp):
        id = req.get_param('id')


        resp.media = {
            'status': 'success',
            'message': '',
            'data': {
                'orderId': id

            }
        }

    def on_put(self, req, resp):

        resp.media = {
            'data': req.get_param('aaa')
        }


